package site.jlopen.kuscia.properties;

import org.secretflow.v1alpha1.constant.KusciaConstants;
import org.secretflow.v1alpha1.factory.TlsConfig;

public class KusciaAPIProperties {
	/**
	 * ApiLite address
	 */
	private String address;
	/**
	 * ApiLite token file
	 */
	private String tokenFile;
	/**
	 * ApiLite protocol
	 */
	private String protocol;
	/**
	 * ApiLite tls config
	 */
	private TlsConfig tls = new TlsConfig();

	public static KusciaAPIProperties nostl(String address) {
		KusciaAPIProperties propertie = new KusciaAPIProperties();
		propertie.setAddress(address);
		propertie.setProtocol(KusciaConstants.KUSCIA_PROTOCOL_NOTLS);
		return propertie;
	}

	public static KusciaAPIProperties stl(String address, String tokenFile, TlsConfig tls) {
		KusciaAPIProperties propertie = new KusciaAPIProperties();
		propertie.setAddress(address);
		propertie.setProtocol(KusciaConstants.KUSCIA_PROTOCOL_TLS);
		propertie.setTokenFile(tokenFile);
		propertie.setTls(tls);
		return propertie;
	}

	public static KusciaAPIProperties mtls(String address, String tokenFile, TlsConfig tls) {
		KusciaAPIProperties propertie = new KusciaAPIProperties();
		propertie.setAddress(address);
		propertie.setProtocol(KusciaConstants.KUSCIA_PROTOCOL_MTLS);
		propertie.setTokenFile(tokenFile);
		propertie.setTls(tls);
		return propertie;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getTokenFile() {
		return tokenFile;
	}

	public void setTokenFile(String tokenFile) {
		this.tokenFile = tokenFile;
	}

	public String getProtocol() {
		return protocol;
	}

	public void setProtocol(String protocol) {
		this.protocol = protocol;
	}

	public TlsConfig getTls() {
		return tls;
	}

	public void setTls(TlsConfig tls) {
		this.tls = tls;
	}

	@Override
	public String toString() {
		return "KusciaAPIProperties [address=" + address + ", tokenFile=" + tokenFile + ", protocol=" + protocol
				+ ", tls=" + tls + "]";
	}

}
